package com.mdp.workflow.biz.re.service;

import com.mdp.core.api.CacheHKVService;
import com.mdp.workflow.biz.re.entity.ProcdefNodeInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.TimeUnit;
 

@Service
public class ProcdefNodeInfoCacheService {
	
	@Autowired
	CacheHKVService cacheHKVService;
	
	
	String cachKey="wf_re_procdef_node_info_";
	
	public void putNodeInfos(String procDefId,String branchId,List<ProcdefNodeInfo> nodeInfos) {
		cacheHKVService.put(cachKey+procDefId, branchId, nodeInfos);
		cacheHKVService.expire(cachKey+procDefId, 100, TimeUnit.DAYS);
	}
	
	public List<ProcdefNodeInfo>   getNodeInfos(String procDefId, String branchId) {
		return (List<ProcdefNodeInfo>) cacheHKVService.get(cachKey+procDefId, branchId);
	}

	
}
